package eu.scillman.net;

import java.net.InetAddress;

/**
 * A member of a server.
 * @author Jiri Waning
 */
public class Member {
	/** The address of the member. **/
	private InetAddress address;
	
	/** The port of the member. **/
	private int port;
	
	/**
	 * Creates a new member for a connection.
	 * @param address The address of the member.
	 * @param port The port of the member.
	 */
	public Member(InetAddress address, int port) {
		this.address = address;
		this.port = port;
	}
	
	/**
	 * Get the address of the member.
	 * @return The address of the member.
	 */
	public InetAddress getAddress() {
		return address;
	}
	
	/**
	 * Get the port of the member.
	 * @return The port of the member.
	 */
	public int getPort() {
		return port;
	}
	
	/**
	 * Prints the canonical name of the host and its port.
	 */
	@Override
	public String toString() {
		return (address.getCanonicalHostName() + ":" + port);
	}
}
